<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>个人设置</title>
</head>
<body>

<div style="width:100%">
    <div class="comm_right">

        <div class="comm_content">

            <div>

                <form id="user_form"  class="form-horizontal" onsubmit="return false;">

                    <div class="form-group">
                        <label for="userID" class="col-sm-3 control-label"> 用户名：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control w300" id="userID" name="userID" placeholder="请输入用户名" readonly="readonly" value="<!--{$user_array.userID}-->">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="trueName" class="col-sm-3 control-label"><span class="red">*</span> 用户姓名：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control w300" id="trueName" name="trueName" placeholder="请输入用户姓名【必填项】" value="<!--{$user_array.trueName}-->">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="userPwd" class="col-sm-3 control-label"> 密码：</label>
                        <div class="col-sm-9">
                            <input type="password" class="form-control w300" id="userPwd" name="userPwd" placeholder="密码 【为空时不修改】" value="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="repeatPwd" class="col-sm-3 control-label"> 密码：</label>
                        <div class="col-sm-9">
                            <input type="password" class="form-control w300" id="repeatPwd" name="repeatPwd" placeholder="密码确认" value="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="mobile" class="col-sm-3 control-label"> 手机号码：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control w300" id="mobile" name="mobile" placeholder="请输入手机号码" value="<!--{$user_array.mobile}-->">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="email" class="col-sm-3 control-label"> email：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control w300" id="email" name="email" placeholder="请输入邮箱地址" value="<!--{$user_array.email}-->">
                        </div>
                    </div>

                    <div class="tac" style="margin-right: 400px;">
                        <input type="button" class="btn btn-success" onclick="user.check();" value="保存" />&nbsp;&nbsp;&nbsp;
                    </div>

                </form>
            </div>
        </div>

    </div>

    <!--{include file='comm/footer.tpl'}-->

</div>

<script type="text/javascript">

    var user = {

        dt: "",

        check: function() {

            this.dt = E.getFormValues("user_form");
            var error_msg = "";

            if (E.isEmpty(this.dt.trueName)) {
                error_msg += "用户姓名不能为空<br>";
            }
            if (!E.isEmpty(this.dt.userPwd)) {
                //mod by allen.qiang 20140924 密码规则变为数字，字母，符号 start
                //if (!E.isPwd(this.dt.userPwd)) {
                if (!E.isPwd_A(this.dt.userPwd)) {
                //mod by allen.qiang 20140924 密码规则变为数字，字母，符号 end
                    error_msg += "输入的密码格式错误<br>";
                } else if (this.dt.userPwd != this.dt.repeatPwd) {
                    error_msg += "两次输入的密码不一致<br>";
                }

            }
            if (!E.isEmpty(this.dt.mobile) && !E.isMobile(this.dt.mobile)) {
                error_msg += "手机号码格式错误<br>";
            }
            if (!E.isEmpty(this.dt.email) && !E.isEmail(this.dt.email)) {
                error_msg += "电子邮件格式错误<br>";
            }

            if (error_msg != "") {
                E.alert(error_msg);
            } else {
                E.confirm("您确认要修改个人信息吗？", "user.edit");
            }

        },

        edit: function() {

            E.loadding.open("正在修改个人信息，请稍候...");
            E.ajax_post({
                url: "/invokingAjax-backend/system/userList.ajax?operFlg=6&xjx=none",
                data: this.dt,
                call: "user.result"
            });

        },

        result: function( o ) {

            E.loadding.close();
            if (o.code == 200) {
                E.alert(o.message, 2, "user.location")
            } else {
                E.alert(o.message);
            }

        },

        location: function() {
            $("#userPwd").val('');
            $("#repeatPwd").val('');
        }

    };

</script>

</body>
</html>